package com.tianji.chat.controller;


import com.tianji.chat.domain.dto.ChatDTO;
import com.tianji.chat.domain.query.ChatPageQuery;
import com.tianji.chat.domain.vo.ChatVO;
import com.tianji.chat.service.IChatService;
import com.tianji.common.domain.dto.PageDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 聊天记录表 前端控制器
 * </p>
 *
 * @author pku-hlp
 * @since 2024-01-13
 */
@RestController
@RequestMapping("/chat")
@RequiredArgsConstructor
@Api(tags = "互动问答相关接口 ")
public class ChatController {

    private final IChatService chatService;

    @ApiOperation("询问大模型并产生对话")
    @PostMapping
    public ChatVO saveReply(@RequestBody ChatDTO chatDTO) {
        return chatService.saveReply(chatDTO);
    }

    @ApiOperation("分页查询当前用户的对话内容")
    @GetMapping("page")
    public PageDTO<ChatVO> queryReplyPage(ChatPageQuery pageQuery){
        return chatService.queryReplyPage(pageQuery);
    }

}
